package model

import (
	"gorm.io/gorm"
	"time"
)

type Comment struct {
	Id            uint32         `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" form:"id" json:"id"`
	VideoId       int32          `gorm:"column:video_id;type:int;comment:视频ID;not null;" form:"video_id" json:"video_id"`                                              // 视频ID
	UserId        int32          `gorm:"column:user_id;type:int;comment:用户ID;not null;" form:"user_id" json:"user_id"`                                                 // 用户ID
	CommentId     int32          `gorm:"column:comment_id;type:int;comment:父评论ID;default:NULL;" form:"comment_id" json:"comment_id"`                                  // 父评论ID
	LoadCommentId int32          `gorm:"column:load_comment_id;type:int;comment:根评论ID;default:NULL;" form:"load_comment_id" json:"load_comment_id"`                   // 根评论ID
	Info          string         `gorm:"column:info;type:varchar(300);comment:评论内容;not null;" form:"info" json:"info"`                                               // 评论内容
	CreatedAt     time.Time      `gorm:"column:created_at;type:datetime(3);comment:创建时间;not null;default:CURRENT_TIMESTAMP(3);" form:"created_at" json:"created_at"` // 创建时间
	UpdatedAt     time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" form:"updated_at" json:"updated_at"`
	DeletedAt     gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" form:"deleted_at" json:"deleted_at"`
}

func (c Comment) TableName() string {
	return "comment"
}
